Issue converting Sitecore Item[] using ToList<T>

Posted by philba888 on Stack Overflow See other posts from Stack Overflow or by philba888
Published on 2010-05-24T06:36:25Z Indexed on 2010/05/24 6:41 UTC
Read the original article Hit count: 424

Filed under:
|
|
|

Working with Sitecore and Linq extensions.

I am trying to convert to from an item array to the list using the following piece of code:

Item variationsFolder = masterDB.SelectSingleItem(VariationsFolderID.ToString());
List<Item> variationList = variationsFolder.GetChildren().ToList<Item>();

However I keep getting this error whenever I try to build:

'Sitecore.Collections.ChildList' does not contain a definition for 'ToList' and the best extension method overload 'System.Linq.Enumerable.ToList<TSource>(System.Collections.Generic.IEnumerable<TSource>)' has some invalid arguments

I have the following usings:

using System.Linq;
using System.Xml.Linq;

Am referencing:

System.Core

I've just copied this code from another location, so it should work fine, can only think that there is something simple (like a reference or something that I am missing).

© Stack Overflow or respective owner

Related posts about c#

Related posts about extensions